package team.star.werespos.model.enums;

import lombok.Getter;
import lombok.ToString;

/**
 * @author huangdonghong/huangdonghong@huya.com
 * @date 2019/05/21 17:53
 */
@Getter
@ToString
public enum TimeRangeEnum {

    /** 每日 */
    DAY(1),
    /** 每周*/
    WEEK(2),
    /** 每月*/
    MONTH(3),
    /** 每季 */
    quarter(4),
    ;

    private Integer range;
    TimeRangeEnum(Integer range) {
        this.range = range;
    }

    public static TimeRangeEnum getByRange(Integer range) {
        TimeRangeEnum[] values = TimeRangeEnum.values();
        for (int i = 0; i < values.length; i++) {
            if (values[i].range.equals(range)) {
                return values[i];
            }
        }
        return DAY;
    }
}
